Skip to content

feat(setup): Add AI-CLI Pup Setup command - #881

Merged
platinummonkey merged 1 commit into
DataDog:mainfrom
tedkahwaji:teddy.kahwaji/first-party-extension-autoinstall
Oct 20, 2026
Merged

platinummonkey merged 1 commit into
DataDog:mainfrom
tedkahwaji:teddy.kahwaji/first-party-extension-autoinstall

Conversation

@tedkahwaji

@tedkahwaji tedkahwaji commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

The following change adds pup setup, which runs Datadog's AI Setup CLI through npx with the user's pup login.

We're consolidating AI Setup into pup so users and agents have one Datadog CLI. AI Setup stays its own Node.js package on npm, and pup setup runs npx -y --package @datadog/ai-setup-cli@latest ai-setup-cli with every argument passed through. That keeps AI Setup releasing on its own schedule and needs no extension install, at the cost of requiring Node.js 22+. The standalone npx @datadog/ai-setup-cli keeps working.

PR Stack

  1. Signup service (Datadog internal): https://github.com/ddoghq/dd-source/pull/120923
  2. AI Setup headless token (Datadog internal): https://github.com/DataDog/ai-setup-cli/pull/477
  3. AI Setup JSON help and pup login reuse (Datadog internal): https://github.com/DataDog/ai-setup-cli/pull/478
  4. pup setup command: feat(setup): Add AI-CLI Pup Setup command #881 <- Current PR
  5. pup on npm: feat(npm): Publish pup as npm package #915

You can find implementation details in the design doc (Datadog internal) and test cases in the test plan (Datadog internal).

Changes

  • Node.js check: requires Node.js 22+ and npx, prints install instructions when either is missing, and sends one best-effort event to the Datadog logs intake so we can measure how often Node blocks setup.
  • Auth: forwards pup's token as DD_ACCESS_TOKEN. When an AI agent is detected or there's no terminal and there's no login, pup points new users to sign-up and runs its own login first. At a terminal, AI Setup's own sign-in runs, then pup offers to log in too.
  • Logins started by setup request api_keys_read, which AI Setup needs to write the org's API key into the project.
  • --site given to setup becomes pup's site for the run, so the login, the site check and AI Setup all agree.
  • pup setup --help shows AI Setup's products and flags in pup's help format.
  • pup's global flags after setup, such as --org and --read-only, are handled by pup. Read-only mode blocks setup but allows its help.
  • PUP_SETUP_AI_SETUP_PACKAGE overrides the npm package, to test unreleased AI Setup builds.

@tedkahwaji tedkahwaji changed the title POC: offer to install first-party extensions on first use POC: built-in pup setup command that installs its extension on first use Oct 5, 2026
@tedkahwaji tedkahwaji changed the title POC: built-in pup setup command that installs its extension on first use feat(setup): add pup setup to run AI Setup from npm Oct 5, 2026
@datadog-datadog-prod-us1

This comment has been minimized.

@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch 4 times, most recently from 37b16df to 29afbd1 Compare October 13, 2026 17:35
@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch 3 times, most recently from c8afc35 to e60a79a Compare October 14, 2026 15:00
@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch from e60a79a to 67807f1 Compare October 14, 2026 16:42
@tedkahwaji tedkahwaji changed the title feat(setup): add pup setup to run AI Setup from npm feat(setup): add pup setup Oct 14, 2026
@tedkahwaji tedkahwaji changed the title feat(setup): add pup setup feat(setup): Add AI-CLI Pup Setup command Oct 14, 2026
@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch 4 times, most recently from 2f7c012 to 472a813 Compare October 20, 2026 13:52
@tedkahwaji
tedkahwaji marked this pull request as ready for review October 20, 2026 14:10
@tedkahwaji
tedkahwaji requested a review from a team as a code owner October 20, 2026 14:10

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

Setup can replace an explicitly configured access token after checking an unrelated saved token’s scopes. Attached and clustered short global flags can also be forwarded to AI Setup instead of being applied by pup.

Open Bits AI session

🤖 Bits Code Review · Commit 472a813

Comment thread src/commands/setup.rs Outdated
Comment thread src/main.rs
`pup setup` runs Datadog's AI Setup CLI with
`npx -y --package @datadog/ai-setup-cli@latest ai-setup-cli`, passing every
argument through. AI Setup is already published to npm, so this needs no
extension install, release repository or checksums, at the cost of
requiring Node.js 22+ when `setup` runs.

- Checks for Node.js 22+ and npx, prints how to install what is missing,
  and sends one best-effort log event (setup_prerequisite_missing,
  service:setup-cli, 2s timeout) to the Datadog logs intake, the channel AI
  Setup uses for its own telemetry, so we can measure how often Node is
  missing. It needs no login, and includes the org UUID (dd_oid) when pup
  has a session.
- Forwards pup's session as DD_ACCESS_TOKEN. When an OAuth session exists,
  shell API/app keys are dropped, and a lone key is never forwarded. The
  help lookup uses the same environment.
- `--site` passed to setup becomes pup's site for the run, so the site
  check, the forwarded session and AI Setup's `--site` all agree.
- Adds --headless when an AI agent is detected (unless --no-agent) or
  stdin/stdout isn't a terminal; a person at a terminal gets AI Setup's
  interactive flow unless they pass --headless.
- Headless runs with no session point people without an account to the
  sign-up page and run pup's OAuth login first. At a terminal, AI Setup's
  own sign-in runs, and pup offers to log in too after a successful run.
- Logins started by pup setup request api_keys_read, which AI Setup needs
  to write the org's API key into the project. A saved session without it
  gets one more login; `pup auth login` is unchanged. `auth::login` now
  returns the session it saved, so setup continues with the right session
  when the login lands in another region or org.
- `pup setup --help` builds a setup command from AI Setup's --help --json
  and renders it as clap help, so new products and flags show up without
  a pup release. `pup setup help` and `pup help setup` are aliases.
- `pup agent schema setup` says setup passes AI Setup's output through
  (ending with an AI_SETUP_RESULT line in headless runs) instead of
  returning an API body.
- pup's global flags work after `setup`, and `pup setup --read-only` is
  blocked, though `pup setup --help` still works in read-only mode.
- PUP_SETUP_AI_SETUP_PACKAGE overrides the package spec (version, tag,
  tarball path or file: spec) to test unreleased AI Setup builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch from 472a813 to b5060c5 Compare October 20, 2026 14:22
@platinummonkey
platinummonkey merged commit 0d61855 into DataDog:main Oct 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants